#include<stdio.h>
#include<unistd.h>
#include"proc.h"
#include<string.h>
#define num  101
#define symbol '='
#define point '.'
#define sym ' '
const int pnum = 6;

void flushprocess(double total,double current)
{
    double rate = (current/total)*100;
//    printf("test:%.1lf%%\r",rate);
//    fflush(stdout);
    
    char bar[num];
    memset(bar,'\0',sizeof(bar));
    int i =0;
    for( i = 0;i<(int)rate;i++)
    {
        bar[i] = symbol;
    }
    
    static int number = 0;
    number++;
    number%=pnum;
    
    char points[pnum+1];
    memset(points,'\0',sizeof(points));
    for(i=0;i<pnum;i++)
    {
        if(i<number) points[i]=point;
        else points[i]= sym;
    }


    printf("[%-100s][%.1lf%%]%s\r",bar,rate,points);
    fflush(stdout);
}
